package com.woniu.dating.controller;

import com.woniu.common.annotation.LoginDating;
import com.woniu.common.constant.RedisKeyConstant;
import com.woniu.common.entity.Result;
import com.woniu.common.entity.ResultCode;
import com.woniu.common.utils.StringUtils;
import com.woniu.dating.pojo.DatingInfo;
import com.woniu.dating.service.IDatingHobbyService;
import com.woniu.dating.service.IDatingInfoService;
import com.woniu.dating.vo.DatingLoginVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 玖柒
 * @since 2023-05-20
 */
@RestController
@RequestMapping("/datingInfo")
@Api(tags = "相亲查看完整信息")
public class DatingInfoController {

    @Resource
    private IDatingInfoService datingInfoService;

    /**
     * 查看当前用户是否查看过该用户
     */
    @ApiOperation("查看用户有没有查看过")
    @GetMapping("/user/{userId}")
    public Result getDatingInfo(@LoginDating DatingLoginVO datingLoginVO, @PathVariable Integer userId) {
         DatingInfo datingInfo = datingInfoService.getDatingInfo(userId, userId);
         if (datingInfo == null) {
             return Result.ok(ResultCode.ERROR);
         }
         return Result.ok(ResultCode.DATING_SUCCESS);
    }

}
